package blog.sys.utils;

/**
 * Created by zzl on 2016/1/15.
 */
public class SysFileUtils {

    public static String getContentType(String fileName) {
        int lastDotPos = fileName.lastIndexOf('.');
        String ext = "";
        if(lastDotPos != -1) {
            ext = fileName.substring(lastDotPos + 1);
        }
        String contentType = "image/jpeg";
        if(ext.equals("png")) {
            contentType = "image/jpeg";
        }
        else if(ext.equals("gif")) {
            contentType = "image/gif";
        }
        return contentType;
    }


}
